package com.hkd.product_service.api.fallback;

import com.hkd.common.api.ApiResponse;
import com.hkd.common.api.BaseFallBack;
import com.hkd.common.api.BaseFallbackFactory;
import com.hkd.product_service.api.ProductInfoService;
import com.hkd.product_service.api.dto.InsertBrandDTO;
import com.hkd.product_service.api.dto.InsertProductDTO;
import org.springframework.stereotype.Component;

/**
 * @author HKD
 * @date 2022/9/17 21:52
 */
@Component
public class ProductInfoServiceImplFallback extends BaseFallbackFactory<ProductInfoService> {
    @Override
    public ProductInfoService create(Throwable throwable) {
        FeignFallback fallback = new FeignFallback();
        fallback.setCause(throwable);
        return fallback;
    }
    public class FeignFallback extends BaseFallBack implements ProductInfoService {
        @Override
        public ApiResponse insertProduct(String curUserId, InsertProductDTO param) {
            return defaultFallBack();
        }
    }
}
